<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class DeliveryWay extends Model
{
    public function setVisitImgAttribute($image)
    {
        if (is_array($image)) {
            $this->attributes['visit_img'] = json_encode($image);
        }
    }

    public function getVisitImgAttribute($image)
    {
        return json_decode($image, true);
    }

    public function setDeliveryTimeImgAttribute($image)
    {
        if (is_array($image)) {
            $this->attributes['delivery_time_img'] = json_encode($image);
        }
    }

    public function getDeliveryTimeImgAttribute($image)
    {
        return json_decode($image, true);
    }

    public function setDeliveryRangeImgAttribute($image)
    {
        if (is_array($image)) {
            $this->attributes['delivery_range_img'] = json_encode($image);
        }
    }

    public function getDeliveryRangeImgAttribute($image)
    {
        return json_decode($image, true);
    }

    public function setChargingStandardImgAttribute($image)
    {
        if (is_array($image)) {
            $this->attributes['charging_standard_img'] = json_encode($image);
        }
    }

    public function getChargingStandardImgAttribute($image)
    {
        return json_decode($image, true);
    }
}
